<template>
  <!-- 子组件必须添加 v-bind="$attrs",  通过父传孙的方式传递给 antd 的原生组件中 -->
  <BasicDrawer
    v-bind="$attrs"
    @register="register"
    @ok="clickOk"
    title="监听抽屉关闭"
    width="40%"
    showFooter
    :closable="false"
    :maskClosable="false"
    okText="确定按钮"
    cancelText="取消按钮"
    :destroyOnClose="false"
  >

  </BasicDrawer>
</template>
<script lang="ts" setup>
  import { BasicDrawer, useDrawerInner } from '@/components/Drawer';

  // register 绑定组件, closeModal: 关闭弹窗, setModalProps: 设置窗口参数
  const [register, { closeDrawer }] = useDrawerInner();

  // 点击确定按钮
  function clickOk() {
    // 需要显示关闭抽屉
    closeDrawer();
  }
</script>
